package com.myx.typhoon.web.security;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.management.relation.Role;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import com.myx.typhoon.sys.service.UserService;

/**  
 * @author myx
 * @createTime 2016年1月18日 下午2:44:25  
 * 
 */
//@Service("sysUserDetailsService")
//public class SysUserDetailsServiceImpl implements UserDetailsService{
public class SysUserDetailsServiceImpl {

//	@Resource
//	private UserService uerService;
	
//	@Override
//	public UserDetails loadUserByUsername(String username)
//			throws UsernameNotFoundException {
//		com.myx.typhoon.business.domain.User userEntity = uerService.findUserByUserName(username);
//		List<GrantedAuthority> authsList = new ArrayList<GrantedAuthority>();
//		for  (Role role:userManager.getRoles(userEntity)) {  
//            authsList.add(new SimpleGrantedAuthority(role.getName()));  
//        } 
//		authsList.add(new SimpleGrantedAuthority("ROLE_USER"));
//		User user = new User(userEntity.getUsername(), userEntity.getPassword(), authsList);
//		return user;
//	}

}
